#include<bits/stdc++.h>
#define ll long long
#define L x<<1
#define R x<<1|1
#define mid (l+r>>1)
#define lc L,l,mid
#define rc R,mid+1,r
#define Root 1,1,n
#define OK l>=Ll&&r<=Rr
#define rep(x,y,z) for(int x=(y);x<=(z);x++)
#define per(x,y,z) for(int x=(y);x>=(z);x--)
#define pb push_back
#define ull unsigned ll
#define e(x) for(int i=h[x],y=to[i];i;i=nxt[i],y=to[i])
#define E(x) for(auto y:p[x])
#define Pi pair<int,int>
#define ui unsigned int 
inline int read(){int s=0,w=1;char c=getchar();while(c<48||c>57) {if(c=='-') w=-1;c=getchar();}while(c>=48&&c<=57) s=(s<<1)+(s<<3)+c-48,c=getchar();return s*w;}
inline void pf(ll x){if(x<0) putchar('-'),x=-x;if(x>9)pf(x/10);putchar(x%10+48);}
const int N =2e5+5,M=4e6+5,inf=2147000000;
const ll llf=1e18;
using namespace std;
int n,l,a[N],b[N],ans;
inline void baoli(int pos,int sum1,int sum2){
	if(pos==n+1){
		if(sum1<=l)ans=max(ans,sum2);
		return;
	}
	baoli(pos+1,sum1^a[pos],sum2^b[pos]);
	baoli(pos+1,sum1,sum2);
}
int main(){
	freopen("lock.in","r",stdin);
	freopen("lock.out","w",stdout);
	n=read(),l=read();
	rep(i,1,n)a[i]=read(),b[i]=read();
	if(n<=18){
		baoli(1,0,0);
		cout <<ans;
	}
	return 0;
}
